/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import cn.webrx.config.SpringConfig;
import cn.webrx.entity.User;
import cn.webrx.entity.UserAddress;
import cn.webrx.entity.UserInfo;
import cn.webrx.mapper.StudentMapper;
import cn.webrx.mapper.UserMapper;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

/**
 * <p>Project: mybatis2021 - SpringDemo
 * <p>Powered by webrx On 2021-07-20 11:23:53
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 15
 */
public class SpringDemo {
    public static void main(String[] args) {
        var ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        var um = ctx.getBean(UserMapper.class);

        List<User> us = um.queryAll();
        for(User u : us){
            System.out.println(u.getUsername());

        }

        //System.out.println(um.queryAll());

        //System.out.println(um.queryByName("admin"));

        //User u = um.show("admin");//
        //System.out.println(u.getUsername());
        //System.out.println(u.getPassword());
        //System.out.println("--------------------");
        //System.out.println(u.getUserinfo().getTruename());
        //for (User u : um.shows()) {
        //    System.out.println(u.getUsername());
        //}
    }

    public static void test(String[] args) {

        var ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        for (String n : ctx.getBeanDefinitionNames()) {
            System.out.println(n);
        }

        var sm = ctx.getBean("sm", StudentMapper.class);
        //System.out.println(sm.ver());
        System.out.println(sm.tbs("hbcf"));
    }
}
